package org.ielse.frame.test;

import java.util.ArrayList;
import java.util.List;

import org.ielse.frame.BaseActivity;
import org.ielse.frame.t.view.medusa.waterdrop.WaterDropListView;
import org.ielse.frame.t.view.medusa.waterdrop.WaterDropListView.IWaterDropListViewListener;

import android.os.Bundle;
import android.widget.ArrayAdapter;

public class Refresh2Activity extends BaseActivity {

	WaterDropListView waterDropListView;

	@Override protected void onCreate(Bundle savedInstanceState) {
		setContentView(waterDropListView = new WaterDropListView(this));
		super.onCreate(savedInstanceState);

		List<String> data = new ArrayList<String>();
		data.add("To see a world in a grain of sand,");
		data.add("And a heaven in a wild flower,");
		data.add("Hold infinity in the palm of your hand,");
		data.add("And eternity in an hour.");

		waterDropListView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, data));
		waterDropListView.setWaterDropListViewListener(new IWaterDropListViewListener() {
			@Override public void onRefresh() {
				waterDropListView.postDelayed(new Runnable() {
					@Override public void run() {
						waterDropListView.stopRefresh();
					}
				}, 2000);
			}

			@Override public void onLoadMore() {
				waterDropListView.postDelayed(new Runnable() {
					@Override public void run() {
						waterDropListView.stopLoadMore();
					}
				}, 2000);
			}
		});
		waterDropListView.setPullLoadEnable(true);
	}

}
